package com.open.controller;

import cn.hutool.core.util.URLUtil;
import cn.hutool.http.HttpRequest;
import cn.hutool.json.JSONObject;
import cn.hutool.json.JSONUtil;
import com.open.annotation.Limit;
import com.open.annotation.Vef;
import com.open.result.OpenResult;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;

/**
 * @author tanyongpeng
 * <p>des</p>
 **/
@RestController
@RequestMapping("/request/open/")
@Slf4j
public class LoginQrcodeController {


//    @GetMapping("/qrcode/url")
//    @Vef
//    @Limit
//    public OpenResult getUrl(@RequestParam String type){
//        try {
//            String redirectUrl = "https://plumgpt.com/#/auth/login";
//            if (type.equals("pc")){
//                redirectUrl = "https://plumgpt.com/#/auth/login";
//            }else if (type.equals("mobile")){
//                redirectUrl = "https://plumgpt.com/#/pages/auth/login";
//            }
//            String body = HttpRequest.get("https://uniqueker.top/connect.php?" +
//                    "act=login" +
//                    "&appid=1496" +
//                    "&appkey=2de695fb12e61606da03fe622b8530d9" +
//                    "&type=wx&redirect_uri=" + URLUtil.encode(redirectUrl)).execute().charset("utf-8").body();
//            JSONObject jsonObject = JSONUtil.parseObj(body);
//            return OpenResult.success(jsonObject.getStr("url"));
//        }catch (Exception e){
//            return OpenResult.error("二维码请求失败");
//        }
//    }

}
